package org.example.java_spring_boot.mapper;


import org.apache.catalina.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.java_spring_boot.entiry.UserEntiry;

import java.util.List;

@Mapper
public interface UserMapper {

    @Select("select * from user where id = #{id}")
    UserEntiry getUserById(Integer id) ;

    @Select("select * from user")
    List<User> getAllUser();
    //通过offset和limit查询部分数据，其中offset为偏移量(跳过前面的x行)，limit为查询条数
    //#{}：占位符，会自动和参数进行对应
    @Select("select * from user limit #{limit} offset #{offset}")
    List<User> getUserByPage(Integer limit, Integer offset);

    
}
